package com.bezdelnick.forum.web.component;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.WebComponent;
import org.apache.wicket.model.Model;

/**
 * Created by IntelliJ IDEA.
 * User: Bezdelnick
 * Date: 04.09.12
 * Time: 9:34
 * To change this template use File | Settings | File Templates.
 */
public class ExternalImageUrl extends WebComponent {

	public ExternalImageUrl(String id, String imageUrl) {
	    super(id);
	    add(new AttributeModifier("src", true, new Model(imageUrl)));
	    setVisible(!(imageUrl==null || imageUrl.equals("")));
	}

	protected void onComponentTag(ComponentTag tag) {
            super.onComponentTag(tag);
            checkComponentTag(tag, "img");
        }

}